package goodenglish.interfaces.videoplay;

import goodenglish.infrastructure.Config;
import javafx.scene.control.Label;
import javafx.scene.effect.Lighting;
import javafx.scene.effect.SepiaTone;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;

public class StudyPane extends BorderPane {
	public Label playLabel = new Label();
	private int studyY = 0;
	private int viewY = Config.SCREEN_HEIGHT - 160;
	int viewHight = 60;
	String blcakStrle = "-fx-background-color: black;-fx-text-alignment:center;-fx-alignment: bottom-center;";
	String noblcakStrle = "-fx-background-color: null;-fx-text-alignment:center;-fx-alignment: bottom-center;";
	String currentStyle = noblcakStrle;

	public StudyPane() {
		playLabel.setText("");
		playLabel.setStyle(noblcakStrle);
		playLabel.setMinHeight(viewHight);
		playLabel.setMinWidth(Config.SCREEN_WIDTH - 40);
		playLabel.setMaxWidth(Config.SCREEN_WIDTH - 40);
		playLabel.setLayoutX(20);
		playLabel.setWrapText(true);
		playLabel.setLayoutY(viewY);
		playLabel.setFont(new Font(40));
		playLabel.setEffect(new Lighting());
		playLabel.setEffect(new SepiaTone());// 产生棕褐色调效果，类似古董的照片。
		playLabel.setTextFill(Color.WHITE);
		this.setCenter(playLabel);
	}

	/**
	 * 为学习展示
	 */
	public void displayForStudy(String str) {

		this.setLayoutY(studyY);
		this.setMinHeight(Config.SCREEN_HEIGHT);
		this.setStyle(this.blcakStrle);
		playLabel.setStyle(this.blcakStrle);
		playLabel.setText(str);

	}

	/**
	 * 为看电影展示
	 */
	public void displayForView(String str) {

		this.setLayoutY(viewY);
		this.setMinHeight(viewHight);
		this.setStyle(this.noblcakStrle);
		// 更新当前的背景色，为上次的背景色
		playLabel.setStyle(this.currentStyle);
		playLabel.setText(str);
	}

	public void setDisplayBackgroud(boolean display) {

		if (display) {
			this.currentStyle = blcakStrle;

		} else {
			this.currentStyle = noblcakStrle;
		}
		playLabel.setStyle(this.currentStyle);
	}
}
